package com.lzwk.app.ods.ocpx;

import com.lzwk.common.ocpx.OCPXConstant;
import org.apache.flink.table.api.TableResult;
import org.apache.flink.table.api.bridge.java.StreamTableEnvironment;

/**
 * @title: JDBCTables
 * @Author Yeaser
 * @Date: 2022/1/29 11:41
 * @Version 1.0
 * Description: TODO
 */
public class OdsJDBCTables {

    public static void ocpxTagInfo(StreamTableEnvironment tenv) {
        tenv.executeSql("CREATE TABLE ocpx_tag_info (" +
                "  id INT, " +
                "  tag_name string, " +
                "  primary key (id) not enforced " +
                ") with ( " +
                "  'connector'='jdbc', " +
                "  'url'='jdbc:mysql://" + OCPXConstant.OCPXSLAVEHOST + ":" + OCPXConstant.OCPXSLAVEPORT + "/" + OCPXConstant.OCPXSLAVEDBNAME + "?characterEncoding=utf8&serverTimezone=Asia/Shanghai&autoReconnect=true&tinyInt1isBit=false&transformedBitIsBoolean=false', " +
                "  'table-name' = " + "'" + OCPXConstant.OCPXJDBCTAGINFO + "'" + ", " +
                "  'username'=" + "'" + OCPXConstant.OCPXSLAVEUSERNAME + "'" + ", " +
                "  'password'=" + "'" + OCPXConstant.OCPXSLAVEPASSWORD + "'" + ", " +
                "  'lookup.cache.max-rows'='5', " +
                "  'lookup.cache.ttl'='600000' " +
                ")");
    }

    public static void ocpxPublicAdminRecordorgref(StreamTableEnvironment tenv) {
        tenv.executeSql("CREATE TABLE ocpx_public_admin_recordorgref (" +
                "  id int, " +
                "  object_type string, " +
                "  object_id int, " +
                "  org_id int, " +
                "  primary key (id) not enforced " +
                ") with ( " +
                "  'connector'='jdbc', " +
                "  'url'='jdbc:mysql://" + OCPXConstant.OCPXSLAVEHOST + ":" + OCPXConstant.OCPXSLAVEPORT + "/" + OCPXConstant.OCPXSLAVEDBNAME + "?characterEncoding=utf8&serverTimezone=Asia/Shanghai&autoReconnect=true&tinyInt1isBit=false&transformedBitIsBoolean=false', " +
                "  'table-name' = " + "'" + OCPXConstant.OCPXJDBCPUBLICADMINRECORDORGREF + "'" + ", " +
                "  'username'=" + "'" + OCPXConstant.OCPXSLAVEUSERNAME + "'" + ", " +
                "  'password'=" + "'" + OCPXConstant.OCPXSLAVEPASSWORD + "'" + ", " +
                "  'lookup.cache.max-rows'='50', " +
                "  'lookup.cache.ttl'='600000' " +
                ")");
    }

    public static void ocpxWxapp(StreamTableEnvironment tenv) {
        tenv.executeSql("CREATE TABLE ocpx_wxapp_wxapp (" +
                "  id INT, " +
                "  nickname string, " +
                "  appid string, " +
                "  primary key (id) not enforced " +
                ") with ( " +
                "  'connector'='jdbc', " +
                "  'url'='jdbc:mysql://" + OCPXConstant.OCPXSLAVEHOST + ":" + OCPXConstant.OCPXSLAVEPORT + "/" + OCPXConstant.OCPXSLAVEDBNAME + "?characterEncoding=utf8&serverTimezone=Asia/Shanghai&autoReconnect=true&tinyInt1isBit=false&transformedBitIsBoolean=false', " +
                "  'table-name' = " + "'" + OCPXConstant.OCPXJDBCWXAPPWXAPP + "'" + ", " +
                "  'username'=" + "'" + OCPXConstant.OCPXSLAVEUSERNAME + "'" + ", " +
                "  'password'=" + "'" + OCPXConstant.OCPXSLAVEPASSWORD + "'" + ", " +
                "  'lookup.cache.max-rows'='20', " +
                "  'lookup.cache.ttl'='600000' " +
                ")");
    }

    public static void ocpxProductProduct(StreamTableEnvironment tenv) {
        tenv.executeSql("CREATE TABLE ocpx_product_product (" +
                "  id INT, " +
                "  name string, " +
                "  tag_id INT, " +
                "  src_prod_id INT, " +
                "  src_prod_type string, " +
                "  primary key (id) not enforced " +
                ") with ( " +
                "  'connector'='jdbc', " +
                "  'url'='jdbc:mysql://" + OCPXConstant.OCPXSLAVEHOST + ":" + OCPXConstant.OCPXSLAVEPORT + "/" + OCPXConstant.OCPXSLAVEDBNAME + "?characterEncoding=utf8&serverTimezone=Asia/Shanghai&autoReconnect=true&tinyInt1isBit=false&transformedBitIsBoolean=false', " +
                "  'table-name' = " + "'" + OCPXConstant.OCPXJDBCPRODUCTPRODUCT + "'" + ", " +
                "  'username'=" + "'" + OCPXConstant.OCPXSLAVEUSERNAME + "'" + ", " +
                "  'password'=" + "'" + OCPXConstant.OCPXSLAVEPASSWORD + "'" + ", " +
                "  'lookup.cache.max-rows'='10', " +
                "  'lookup.cache.ttl'='600000' " +
                ")");
    }

    public static void ocpxProductProductSkin(StreamTableEnvironment tenv) {

        tenv.executeSql("CREATE TABLE ocpx_product_productskin (" +
                "  id INT, " +
                "  name string, " +
                "  primary key (id) not enforced " +
                ") with ( " +
                "  'connector'='jdbc', " +
                "  'url'='jdbc:mysql://" + OCPXConstant.OCPXSLAVEHOST + ":" + OCPXConstant.OCPXSLAVEPORT + "/" + OCPXConstant.OCPXSLAVEDBNAME + "?characterEncoding=utf8&serverTimezone=Asia/Shanghai&autoReconnect=true&tinyInt1isBit=false&transformedBitIsBoolean=false', " +
                "  'table-name' = " + "'" + OCPXConstant.OCPXJDBCPRODUCTPRODUCTSKIN + "'" + ", " +
                "  'username'=" + "'" + OCPXConstant.OCPXSLAVEUSERNAME + "'" + ", " +
                "  'password'=" + "'" + OCPXConstant.OCPXSLAVEPASSWORD + "'" + ", " +
                "  'lookup.cache.max-rows'='20', " +
                "  'lookup.cache.ttl'='600000' " +
                ")");
    }

    public static void ocpxPromotePromotesource(StreamTableEnvironment tenv) {
        tenv.executeSql(" CREATE TABLE ocpx_promote_promotesource ( " +
                "  id INT, " +
                "  skin_id INT, " +
                "  hash_id string, " +
                "  product_id INT, " +
                "  wxapp_id INT, " +
                "  name string, " +
                "  meta string, " +
                "  primary key (id) not enforced " +
                ") with ( " +
                "  'connector' = 'jdbc', " +
                "  'driver' = 'com.mysql.cj.jdbc.Driver', " +
                "  'url'='jdbc:mysql://" + OCPXConstant.OCPXSLAVEHOST + ":" + OCPXConstant.OCPXSLAVEPORT + "/" + OCPXConstant.OCPXSLAVEDBNAME + "?characterEncoding=utf8&serverTimezone=Asia/Shanghai&autoReconnect=true&tinyInt1isBit=false&transformedBitIsBoolean=false', " +
                "  'table-name' = " + "'" + OCPXConstant.OCPXJDBCPROMOTEPROMOTESOURCE + "'" + ", " +
                "  'username'=" + "'" + OCPXConstant.OCPXSLAVEUSERNAME + "'" + ", " +
                "  'password'=" + "'" + OCPXConstant.OCPXSLAVEPASSWORD + "'" + ", " +
                "  'lookup.cache.max-rows'='20', " +
                "  'lookup.cache.max-rows'='20', " +
                "  'lookup.cache.ttl'='600000' " +
                ")");
    }

    public static void ocpxWxappOceancreativeinfo(StreamTableEnvironment tenv) {
        tenv.executeSql(" CREATE TABLE ocpx_wxapp_oceancreativeinfo ( " +
                "  `id` INT, " +
                "  `creative_id` STRING, " +
                "  `ad_plan_id` STRING, " +
                "  `title` STRING, " +
                "  `account_info_id` INT, " +
                "  primary key (id) not enforced " +
                ") with ( " +
                "  'connector' = 'jdbc', " +
                "  'driver' = 'com.mysql.cj.jdbc.Driver', " +
                "  'url'='jdbc:mysql://"+ OCPXConstant.OCPXSLAVEHOST+ ":" + OCPXConstant.OCPXSLAVEPORT + "/" + OCPXConstant.OCPXSLAVEDBNAME +"?characterEncoding=utf8&serverTimezone=Asia/Shanghai&autoReconnect=true&tinyInt1isBit=false&transformedBitIsBoolean=false', " +
                "  'table-name' = " + "'" + OCPXConstant.OCPXJDBCWXAPPOCEANCREATIVEINFO + "'" + ", " +
                "  'username'=" + "'" + OCPXConstant.OCPXSLAVEUSERNAME + "'" + ", " +
                "  'password'=" + "'" + OCPXConstant.OCPXSLAVEPASSWORD + "'" + ", " +
                "  'lookup.cache.max-rows'='2000', " +
                "  'lookup.cache.ttl'='600000' " +
                ")");
    }


    public static void ocpxWxappOceanadplandata(StreamTableEnvironment tenv) {
        tenv.executeSql(" CREATE TABLE ocpx_wxapp_oceanadplandata ( " +
                "  `id` INT, " +
                "  `ad_plan_id` STRING, " +
                "  `name` STRING, " +
                "  `campaign_id` STRING, " +
                "  `account_info_id` INT, " +
                "  primary key (id) not enforced " +
                ") with ( " +
                "  'connector' = 'jdbc', " +
                "  'driver' = 'com.mysql.cj.jdbc.Driver', " +
                "  'url'='jdbc:mysql://" + OCPXConstant.OCPXSLAVEHOST + ":" + OCPXConstant.OCPXSLAVEPORT + "/" + OCPXConstant.OCPXSLAVEDBNAME + "?characterEncoding=utf8&serverTimezone=Asia/Shanghai&autoReconnect=true&tinyInt1isBit=false&transformedBitIsBoolean=false', " +
                "  'table-name' = " + "'" + OCPXConstant.OCPXJDBCWXAPPOCEANADPLANDATA + "'" + ", " +
                "  'username'=" + "'" + OCPXConstant.OCPXSLAVEUSERNAME + "'" + ", " +
                "  'password'=" + "'" + OCPXConstant.OCPXSLAVEPASSWORD + "'" + ", " +
                "  'lookup.cache.max-rows'='1000', " +
                "  'lookup.cache.ttl'='600000' " +
                ")");
    }

    public static void ocpxWxappOceancampaigndata(StreamTableEnvironment tenv) {
        tenv.executeSql(" CREATE TABLE ocpx_wxapp_oceancampaigndata ( " +
                "  `id` INT, " +
                "  `name` STRING, " +
                "  `campaign_id` STRING, " +
                "  `account_info_id` INT, " +
                "  primary key (id) not enforced " +
                ") with ( " +
                "  'connector' = 'jdbc', " +
                "  'driver' = 'com.mysql.cj.jdbc.Driver', " +
                "  'url'='jdbc:mysql://" + OCPXConstant.OCPXSLAVEHOST + ":" + OCPXConstant.OCPXSLAVEPORT + "/" + OCPXConstant.OCPXSLAVEDBNAME + "?characterEncoding=utf8&serverTimezone=Asia/Shanghai&autoReconnect=true&tinyInt1isBit=false&transformedBitIsBoolean=false', " +
                "  'table-name' = " + "'" + OCPXConstant.OCPXJDBCWXAPPOCEANCAMPAIGNDATA + "'" + ", " +
                "  'username'=" + "'" + OCPXConstant.OCPXSLAVEUSERNAME + "'" + ", " +
                "  'password'=" + "'" + OCPXConstant.OCPXSLAVEPASSWORD + "'" + ", " +
                "  'lookup.cache.max-rows'='500', " +
                "  'lookup.cache.ttl'='600000' " +
                ")");
    }


    public static void ocpxWxappOceanaccountInfo(StreamTableEnvironment tenv) {
        tenv.executeSql(" CREATE TABLE ocpx_wxapp_oceanaccountinfo ( " +
                "  `id` INT, " +
                "  `account_id` STRING, " +
                "  `account_name` STRING, " +
                "  `auth_info_id` INT, " +
                "  primary key (id) not enforced " +
                ") with ( " +
                "  'connector' = 'jdbc', " +
                "  'driver' = 'com.mysql.cj.jdbc.Driver', " +
                "  'url'='jdbc:mysql://" + OCPXConstant.OCPXSLAVEHOST + ":" + OCPXConstant.OCPXSLAVEPORT + "/" + OCPXConstant.OCPXSLAVEDBNAME + "?characterEncoding=utf8&serverTimezone=Asia/Shanghai&autoReconnect=true&tinyInt1isBit=false&transformedBitIsBoolean=false', " +
                "  'table-name' = " + "'" + OCPXConstant.OCPXJDBCWXAPPOCEANACCOUNTINFO + "'" + ", " +
                "  'username'=" + "'" + OCPXConstant.OCPXSLAVEUSERNAME + "'" + ", " +
                "  'password'=" + "'" + OCPXConstant.OCPXSLAVEPASSWORD + "'" + ", " +
                "  'lookup.cache.max-rows'='100', " +
                "  'lookup.cache.ttl'='600000' " +
                ")");
    }


    public static void ocpxWxappMpadgroupData(StreamTableEnvironment tenv) {
        tenv.executeSql(" CREATE TABLE ocpx_wxapp_mpadgroupdata ( " +
                "  `id` INT, " +
                "  `account_info_id` INT, " +
                "  `campaign_id` STRING, " +
                "  `ad_group_id` STRING, " +
                "  `ad_group_name` STRING, " +
                "  primary key (id) not enforced " +
                ") with ( " +
                "  'connector' = 'jdbc', " +
                "  'driver' = 'com.mysql.cj.jdbc.Driver', " +
                "  'url'='jdbc:mysql://" + OCPXConstant.OCPXSLAVEHOST + ":" + OCPXConstant.OCPXSLAVEPORT + "/" + OCPXConstant.OCPXSLAVEDBNAME + "?characterEncoding=utf8&serverTimezone=Asia/Shanghai&autoReconnect=true&tinyInt1isBit=false&transformedBitIsBoolean=false', " +
                "  'table-name' = " + "'" + OCPXConstant.OCPXJDBCWXAPPMPADGROUPDATA + "'" + ", " +
                "  'username'=" + "'" + OCPXConstant.OCPXSLAVEUSERNAME + "'" + ", " +
                "  'password'=" + "'" + OCPXConstant.OCPXSLAVEPASSWORD + "'" + ", " +
                "  'lookup.cache.max-rows'='1000', " +
                "  'lookup.cache.ttl'='600000' " +
                ")");
    }


    public static void ocpxWxappMpcampaignData(StreamTableEnvironment tenv) {
        tenv.executeSql(" CREATE TABLE ocpx_wxapp_mpcampaigndata ( " +
                "  `id` INT, " +
                "  `account_info_id` INT, " +
                "  `campaign_id` STRING, " +
                "  `campaign_name` STRING, " +
                "  primary key (id) not enforced " +
                ") with ( " +
                "  'connector' = 'jdbc', " +
                "  'driver' = 'com.mysql.cj.jdbc.Driver', " +
                "  'url'='jdbc:mysql://" + OCPXConstant.OCPXSLAVEHOST + ":" + OCPXConstant.OCPXSLAVEPORT + "/" + OCPXConstant.OCPXSLAVEDBNAME + "?characterEncoding=utf8&serverTimezone=Asia/Shanghai&autoReconnect=true&tinyInt1isBit=false&transformedBitIsBoolean=false', " +
                "  'table-name' = " + "'" + OCPXConstant.OCPXJDBCWXAPPMPCAMPAIGNDATA + "'" + ", " +
                "  'username'=" + "'" + OCPXConstant.OCPXSLAVEUSERNAME + "'" + ", " +
                "  'password'=" + "'" + OCPXConstant.OCPXSLAVEPASSWORD + "'" + ", " +
                "  'lookup.cache.max-rows'='500', " +
                "  'lookup.cache.ttl'='600000' " +
                ")");
    }

    public static void ocpxWxappMpaccountInfo(StreamTableEnvironment tenv) {
        tenv.executeSql(" CREATE TABLE ocpx_wxapp_mpaccountinfo ( " +
                "  `id` INT, " +
                "  `auth_info_id` INT, " +
                "  `account_id` STRING, " +
                "  `account_name` STRING, " +
                "  primary key (id) not enforced " +
                ") with ( " +
                "  'connector' = 'jdbc', " +
                "  'driver' = 'com.mysql.cj.jdbc.Driver', " +
                "  'url'='jdbc:mysql://" + OCPXConstant.OCPXSLAVEHOST + ":" + OCPXConstant.OCPXSLAVEPORT + "/" + OCPXConstant.OCPXSLAVEDBNAME + "?characterEncoding=utf8&serverTimezone=Asia/Shanghai&autoReconnect=true&tinyInt1isBit=false&transformedBitIsBoolean=false', " +
                "  'table-name' = " + "'" + OCPXConstant.OCPXJDBCWXAPPMPACCOUNTINFO + "'" + ", " +
                "  'username'=" + "'" + OCPXConstant.OCPXSLAVEUSERNAME + "'" + ", " +
                "  'password'=" + "'" + OCPXConstant.OCPXSLAVEPASSWORD + "'" + ", " +
                "  'lookup.cache.max-rows'='20', " +
                "  'lookup.cache.ttl'='600000' " +
                ")");
    }


    public static void ocpxPlatformAccountInfo(StreamTableEnvironment tenv) {
        tenv.executeSql(" CREATE TABLE ocpx_platform_account_info ( " +
                "  `id` INT, " +
                "  `auth_info_id` INT, " +
                "  `account_id` STRING, " +
                "  `account_name` STRING, " +
                "  primary key (id) not enforced " +
                ") with ( " +
                "  'connector' = 'jdbc', " +
                "  'driver' = 'com.mysql.cj.jdbc.Driver', " +
                "  'url'='jdbc:mysql://" + OCPXConstant.OCPXSLAVEHOST + ":" + OCPXConstant.OCPXSLAVEPORT + "/" + OCPXConstant.OCPXSLAVEDBNAME + "?characterEncoding=utf8&serverTimezone=Asia/Shanghai&autoReconnect=true&tinyInt1isBit=false&transformedBitIsBoolean=false', " +
                "  'table-name' = " + "'" + OCPXConstant.OCPXJDBCPLATFORMACCOUNTINFO + "'" + ", " +
                "  'username'=" + "'" + OCPXConstant.OCPXSLAVEUSERNAME + "'" + ", " +
                "  'password'=" + "'" + OCPXConstant.OCPXSLAVEPASSWORD + "'" + ", " +
                "  'lookup.cache.max-rows'='5', " +
                "  'lookup.cache.ttl'='600000' " +
                ")");
    }


    public static void ocpxWxappQQauthorizationInfo(StreamTableEnvironment tenv) {
        tenv.executeSql(" CREATE TABLE ocpx_wxapp_qqauthorizationinfo ( " +
                "  `id` INT, " +
                "  `state` STRING, " +
                "  primary key (id) not enforced " +
                ") with ( " +
                "  'connector' = 'jdbc', " +
                "  'driver' = 'com.mysql.cj.jdbc.Driver', " +
                "  'url'='jdbc:mysql://" + OCPXConstant.OCPXSLAVEHOST + ":" + OCPXConstant.OCPXSLAVEPORT + "/" + OCPXConstant.OCPXSLAVEDBNAME + "?characterEncoding=utf8&serverTimezone=Asia/Shanghai&autoReconnect=true&tinyInt1isBit=false&transformedBitIsBoolean=false', " +
                "  'table-name' = " + "'" + OCPXConstant.OCPXJDBCWXAPPQQAUTHORIZATIONINFO + "'" + ", " +
                "  'username'=" + "'" + OCPXConstant.OCPXSLAVEUSERNAME + "'" + ", " +
                "  'password'=" + "'" + OCPXConstant.OCPXSLAVEPASSWORD + "'" + ", " +
                "  'lookup.cache.max-rows'='20', " +
                "  'lookup.cache.ttl'='600000' " +
                ")");
    }



    public static void ocpxAccountAccount(StreamTableEnvironment tenv) {

        tenv.executeSql(" CREATE TABLE ods_ocpx_account_account ( " +
                " `id` INT, " +
                " `openid` STRING, " +
                " `unionid` STRING, " +
                " `nickname` STRING, " +
                " `headimgurl` STRING, " +
                " `sex` INT, " +
                " `province` STRING, " +
                " `country` STRING, " +
                " `city` STRING, " +
                " `status` INT, " +
                " `is_robot` INT, " +
                " `active_ip` STRING, " +
                " `active_time` TIMESTAMP(0), " +
                " `create_time` TIMESTAMP(0), " +
                " `is_init` INT, " +
                " `src` STRING, " +
                " `parent_account_id` INT, " +
                "  PRIMARY KEY (`id`) NOT ENFORCED" +
                ") with ( " +
                "  'connector' = 'jdbc', " +
                "  'driver' = 'com.mysql.cj.jdbc.Driver', " +
                "  'url'='jdbc:mysql://" + OCPXConstant.OCPXSLAVEHOST + ":" + OCPXConstant.OCPXSLAVEPORT + "/" + OCPXConstant.OCPXSLAVEDBNAME + "?characterEncoding=utf8&serverTimezone=Asia/Shanghai&autoReconnect=true&tinyInt1isBit=false&transformedBitIsBoolean=false', " +
                "  'table-name' = " + "'" + OCPXConstant.OCPXJDBCACCOUNTACCOUNT + "'" + ", " +
                "  'username'=" + "'" + OCPXConstant.OCPXSLAVEUSERNAME + "'" + ", " +
                "  'password'=" + "'" + OCPXConstant.OCPXSLAVEPASSWORD + "'" + ", " +
                "  'lookup.cache.max-rows'='2000', " +
                "  'lookup.cache.ttl'='600000' " +
                ")");
    }



    public static void ocpxAccountWxuser(StreamTableEnvironment tenv) {

        tenv.executeSql(" CREATE TABLE ods_ocpx_account_wxuser ( " +
                " `id` INT, " +
                " `openid` STRING, " +
                " `unionid` STRING, " +
                " `headimgurl` STRING, " +
                " `sex` INT, " +
                " `nickname` STRING, " +
                " `subscribed` INT, " +
                " `create_time` TIMESTAMP(0), " +
                " `active_ip` STRING, " +
                " `active_time` TIMESTAMP(0), " +
                " `update_time` TIMESTAMP(0), " +
                " `account_id` INT, " +
                " `wxapp_id` INT, " +
                "  PRIMARY KEY (`id`) NOT ENFORCED" +
                ") with ( " +
                "  'connector' = 'jdbc', " +
                "  'driver' = 'com.mysql.cj.jdbc.Driver', " +
                "  'url'='jdbc:mysql://" + OCPXConstant.OCPXSLAVEHOST + ":" + OCPXConstant.OCPXSLAVEPORT + "/" + OCPXConstant.OCPXSLAVEDBNAME + "?characterEncoding=utf8&serverTimezone=Asia/Shanghai&autoReconnect=true&tinyInt1isBit=false&transformedBitIsBoolean=false', " +
                "  'table-name' = " + "'" + OCPXConstant.OCPXJDBCACCOUNTWXUSER + "'" + ", " +
                "  'username'=" + "'" + OCPXConstant.OCPXSLAVEUSERNAME + "'" + ", " +
                "  'password'=" + "'" + OCPXConstant.OCPXSLAVEPASSWORD + "'" + ", " +
                "  'lookup.cache.max-rows'='200', " +
                "  'lookup.cache.ttl'='600000' " +
                ")");
    }


    public static void ocpxMpSubFeedBack(StreamTableEnvironment tenv) {

        tenv.executeSql(" CREATE TABLE ods_ocpx_wxapp_mpadsubfeedbackdata ( " +
                " `id` INT, " +
                " `trace_id` STRING, " +
                " `account_info_id` INT, " +
                " `openid` STRING, " +
                " `wechat_account_id` STRING, " +
                " `wechat_agency_id` STRING, " +
                " `campaign_id` STRING, " +
                " `ad_group_id` STRING, " +
                " `subscribe_time` STRING, " +
                " `position_id` STRING, " +
                " `create_time` TIMESTAMP(0), " +
                " `update_time` TIMESTAMP(0), " +
                "  PRIMARY KEY (`id`) NOT ENFORCED" +
                ") with ( " +
                "  'connector' = 'jdbc', " +
                "  'driver' = 'com.mysql.cj.jdbc.Driver', " +
                "  'url'='jdbc:mysql://" + OCPXConstant.OCPXSLAVEHOST + ":" + OCPXConstant.OCPXSLAVEPORT + "/" + OCPXConstant.OCPXSLAVEDBNAME + "?characterEncoding=utf8&serverTimezone=Asia/Shanghai&autoReconnect=true&tinyInt1isBit=false&transformedBitIsBoolean=false', " +
                "  'table-name' = " + "'" + OCPXConstant.OCPXJDBCMPFEEDBACK + "'" + ", " +
                "  'username'=" + "'" + OCPXConstant.OCPXSLAVEUSERNAME + "'" + ", " +
                "  'password'=" + "'" + OCPXConstant.OCPXSLAVEPASSWORD + "'" + ", " +
                "  'lookup.cache.max-rows'='2000', " +
                "  'lookup.cache.ttl'='600000' " +
                ")");
    }


    public static void ocpxOceanAuthorInfo(StreamTableEnvironment tenv) {

        tenv.executeSql(" CREATE TABLE ocpx_wxapp_oceanauthorizationinfo ( " +
                " `id` INT, " +
                " `is_authorized` INT, " +
                " `state` STRING, " +
                " `access_token` STRING, " +
                " `refresh_token` STRING, " +
                " `access_token_expires_time` INT, " +
                " `refresh_token_expires_time` INT, " +
                " `create_time` TIMESTAMP(0), " +
                " `update_time` TIMESTAMP(0), " +
                " `app_type` STRING, " +
                " `app_id` STRING, " +
                "  PRIMARY KEY (`id`) NOT ENFORCED" +
                ") with ( " +
                "  'connector' = 'jdbc', " +
                "  'driver' = 'com.mysql.cj.jdbc.Driver', " +
                "  'url'='jdbc:mysql://" + OCPXConstant.OCPXSLAVEHOST + ":" + OCPXConstant.OCPXSLAVEPORT + "/" + OCPXConstant.OCPXSLAVEDBNAME + "?characterEncoding=utf8&serverTimezone=Asia/Shanghai&autoReconnect=true&tinyInt1isBit=false&transformedBitIsBoolean=false', " +
                "  'table-name' = " + "'" + OCPXConstant.OCPXJDBCOCEANAUTHORINFO + "'" + ", " +
                "  'username'=" + "'" + OCPXConstant.OCPXSLAVEUSERNAME + "'" + ", " +
                "  'password'=" + "'" + OCPXConstant.OCPXSLAVEPASSWORD + "'" + ", " +
                "  'lookup.cache.max-rows'='20', " +
                "  'lookup.cache.ttl'='600000' " +
                ")");
    }


    public static void ocpxPayOrder(StreamTableEnvironment tenv) {

        tenv.executeSql(" CREATE TABLE ocpx_pay_order ( " +
                " `id` INT, " +
                " `payee_id` BIGINT, " +
                " `payee_type` STRING, " +
                " `fee` BIGINT, " +
                " `product_type` BIGINT, " +
                " `product_id` BIGINT, " +
                " `source_id` BIGINT, " +
                " `skin_id` BIGINT, " +
                " `wxapp_id` BIGINT, " +
                " `paid` INT, " +
                " `deliver_status` BIGINT, " +
                " `refund_status` BIGINT, " +
                " `create_time` TIMESTAMP(0), " +
                " `pay_time` TIMESTAMP(0), " +
                " `callback_time` TIMESTAMP(0), " +
                " `outer_order_id` STRING, " +
                " `meta` STRING NOT NULL, " +
                " `ip` STRING, " +
                " `payer_id` INT, " +
                " `source` STRING, " +
                " `is_notified` INT, " +
                " `update_time` TIMESTAMP(0), " +
                " `openid` STRING, " +
                " `proc_time` AS PROCTIME(), " +
                "  PRIMARY KEY (`id`) NOT ENFORCED" +
                ") with ( " +
                "  'connector' = 'jdbc', " +
                "  'driver' = 'com.mysql.cj.jdbc.Driver', " +
                "  'url'='jdbc:mysql://"+ OCPXConstant.OCPXSLAVEHOST+ ":" + OCPXConstant.OCPXSLAVEPORT + "/" + OCPXConstant.OCPXSLAVEDBNAME + "?characterEncoding=utf8&serverTimezone=Asia/Shanghai&autoReconnect=true&tinyInt1isBit=false&transformedBitIsBoolean=false', " +
                "  'table-name' = " + "'" + OCPXConstant.OCPXJDBCPAYORDER + "'" + ", " +
                "  'username'=" + "'" + OCPXConstant.OCPXSLAVEUSERNAME + "'" + ", " +
                "  'password'=" + "'" + OCPXConstant.OCPXSLAVEPASSWORD + "'" + ", " +
                "  'lookup.cache.max-rows'='1000', " +
                "  'lookup.cache.ttl'='600000' " +
                ")");
    }


}
